/** string $rights Contain rights values : "foo,bar,bla" */
var $rights;
/**#@-*/
-
+
/** Constructor */
function Group() {
$this->clear();
// be sure it's an integer
$this->id = intval($this->id);
-
+
if($this->id) {
// By ID
$dbr =& wfGetDB( DB_SLAVE );
$this->description = $row->gr_description;
$this->rights = $row->gr_rights;
$this->dataLoaded = true;
- }
-
+ }
+
/** Initialise a new row in the database */
function addToDatabase() {
if ( Group::getStaticGroups() ) {
wfDebugDieBacktrace( "Can't modify groups in static mode" );
}
if($this->id == 0) { return; }
-
+
$fname = 'Group::save';
$dbw =& wfGetDB( DB_MASTER );
-
+
$dbw->update( 'groups',
array( /* SET */
'gr_name' => $this->name,
'gr_id' => $this->id
), $fname
);
-
+
$wgMemc->set( Group::getCacheKey( $this->id ), $this, 3600 );
}
wfDebugDieBacktrace( "Can't modify groups in static mode" );
}
if($this->id == 0) { return; }
-
+
$fname = 'Group::delete';
$dbw =& wfGetDB( DB_MASTER );
$wgMemc->delete( Group::getCacheKey( $this->id ) );
}
-
+
/**
* Get memcached key
* @static
function newFromId($id) {
global $wgMemc, $wgDBname;
$fname = 'Group::newFromId';
-
+
$staticGroups =& Group::getStaticGroups();
if ( $staticGroups ) {
if ( array_key_exists( $id, $staticGroups ) ) {
wfDebug( "$fname loaded group $id from cache\n" );
return $group;
}
-
+
$group = new Group();
$group->id = $id;
$group->loadFromDatabase();
/** @param string $name Group database name */
function newFromName($name) {
$fname = 'Group::newFromName';
-
+
$staticGroups =& Group::getStaticGroups();
if ( $staticGroups ) {
$id = Group::idFromName( $name );
return null;
}
}
-
+
$g = new Group();
$g->name = $name;
$g->loadFromDatabase();
$this->loadFromDatabase();
return $this->getMessage( $this->name );
}
-
+
function getNameForContent() {
$this->loadFromDatabase();
return $this->getMessageForContent( $this->name );
$this->loadFromDatabase();
$this->name = $name;
}
-
+
function getId() { return $this->id; }
function setId($id) {
$this->id = intval($id);
$this->dataLoaded = false;
}
-
+
function getDescription() {
return $this->description;
}